package cn.lei.uicontrols;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.Gallery;

public class AtyUsingGallery extends AppCompatActivity {

    private Gallery mGallery;
    private ArrayAdapter<String> mAdapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_aty_using_gallery);

        mAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1);
        for (int i = 0; i < 20; i++) {
            mAdapter.add("item" + i);
        }

        mGallery = (Gallery) findViewById(R.id.gallery);
        mGallery.setAdapter(mAdapter);
    }
}
